class Solution {
public:
    bool isAnagram(string s, string t) {
        if (s.length() != t.length()) {
            return false;
        }
        int count[26] = { 0 };

        for (int i = 0; i < s.length(); ++i) {
            count[s[i] - 'a']++;
            count[t[i] - 'a']--;
        }

        for (int i = 0; i < 26; ++i) {
            if (count[i] != 0) {
                return false;
            }
        }
        return true;
    }
};




class Solution {
public:
    bool halvesAreAlike(string s) {
        int n = s.length();
        int countA = 0, countB = 0;
        std::unordered_set<char> vowels = { 'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U' };

        for (int i = 0; i < n / 2; ++i) {
            if (vowels.count(s[i])) {
                ++countA;
            }
            if (vowels.count(s[i + n / 2])) {
                ++countB;
            }
        }

        return countA == countB;
    }
};